<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">KNNRULE</b>
<td valign="baseline" align="right" class="function"><a href="../misc/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Creates K-nearest neighbours classifier.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;model=knnrule(data)</span><br>
<span class=help>&nbsp;&nbsp;model=knnrule(data,K)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;It&nbsp;creates&nbsp;model&nbsp;of&nbsp;the&nbsp;K-nearest&nbsp;neighbour&nbsp;classifier.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;data.X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Prototypes&nbsp;(training)&nbsp;data.</span><br>
<span class=help>&nbsp;&nbsp;data.y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Labels&nbsp;of&nbsp;training&nbsp;data.</span><br>
<span class=help>&nbsp;&nbsp;K&nbsp;[1x1]&nbsp;Number&nbsp;of&nbsp;the&nbsp;nerest&nbsp;neighbours&nbsp;(default&nbsp;1).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;[struct]&nbsp;Model&nbsp;of&nbsp;K-NN&nbsp;classifier.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.X&nbsp;=&nbsp;data.X.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.y&nbsp;=&nbsp;data.y.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.K&nbsp;=&nbsp;K.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.num_data&nbsp;[1x1]&nbsp;number&nbsp;of&nbsp;prototypes.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.fun&nbsp;[string]&nbsp;Contains&nbsp;'knnclass'.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;data=load('riply_trn');</span><br>
<span class=help>&nbsp;&nbsp;model=knnrule(data,1);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;ppatterns(data);&nbsp;pboundary(model);</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../misc/knnclass.html" target="mdsbody">KNNCLASS</a>.</span><br>
<span class=help></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../misc/list/knnrule.html">knnrule.m</a>
</body>
</html>
